import 'package:flutter/material.dart';

class MyApp2 extends StatelessWidget {
  const MyApp2({super.key, this.age = 18});

   // 年龄组件
  final int age;

  @override
  Widget build(BuildContext context) {
    // const int age = 18;

    return Scaffold(
      // 1. 导航条
      appBar: AppBar(
        title: const Text('无状态组件'),
        backgroundColor: Colors.pink,
      ),
      // 2. 主体内容
      body: Center(
        child: Text(
          '我叫玛利亚, 今年$age岁',
          style: const TextStyle(fontSize: 30),
        ),
      ),
    );
  }
}
